package com.ymatou.iapi.prodstock.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.ModifyResult;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;
/**
*调拨活动库存Call
*FreeMaker Template自动生成代码
*/
public class AllocateProductActivityStockCall extends YmatouBaseCall{
	private static String opurl ="api/Product/AllocateProductActivityStock";
	
	public AllocateProductActivityStockCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
		//super(EnvSetup.getSystemUrl("productstock_api"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<ModifyResult> getModifyResultList(){
		String sModifyResult=getJsonObject().get("Data").getAsJsonObject().get("XLoboResult").getAsJsonObject().get("BatchModifyResults").getAsJsonArray().toString();
		List<ModifyResult> ModifyResultList=(List<ModifyResult>)FormatUtil.GSONToObject(sModifyResult, new TypeToken<List<ModifyResult>>(){}.getType());
		return ModifyResultList;
	}
}